package com.zttek.photosShareProject.modules.service.share;

import com.baomidou.mybatisplus.plugins.Page;
import com.zttek.photosShareProject.common.json.ShareVO;
import com.zttek.photosShareProject.common.json.UserVO;
import com.zttek.photosShareProject.common.myException.DBException;
import com.zttek.photosShareProject.modules.model.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Y
 * Date: 2017-08-18
 * Time: 14:48
 */
public interface IShareService {

    /**
     * 发布分享，并转发至审核区
     *
     * @param imagesId *
     * @param content *
     * @param atIds @用户id列
     * @param userId *
     * @param sourceId 转发源shareId
     * @param hide 是否屏蔽
     * @return *
     */
    Share newShare(Long[] imagesId, String content, Long[] atIds, Long userId, Long sourceId, boolean hide) throws Exception;

    /**
     * 根据id删除分享
     *
     * @param shareId *
     */
    void deleteShare(Long shareId) throws Exception;

    /**
     * 根据id查询分享
     *
     * @param shareId *
     * @return *
     */
    Share selectShare(Long shareId) throws Exception;

    List<Share> selectShareByIdList(List<Long> ids) throws Exception;

    /**
     * 查询更多分享
     *
     * @param page *
     * @param userId 浏览者
     * @return *
     */
    Page<Share> selectPublicShare(Page<Share> page, Long userId) throws Exception;

    Page<Share> selectSelfShare(Page<Share> page, Long userId) throws Exception;

    Page<Share> selectHideShare(Page<Share> page, Long userId) throws Exception;

    Page<Share> selectCollectShare(Page<Share> page, Long userId) throws Exception;

    void updatePraiseCount(Long shareId, boolean isPlus) throws Exception;

    void updateCommentCount(Long shareId, boolean isPlus) throws Exception;

    void updateShare(Share share)throws Exception;

    /**
     * 点赞
     *
     * @param shareId *
     * @param userId *
     * @param isPlus 正方向
     */
    void praise(Long shareId, Long userId, boolean isPlus) throws Exception;

    /**
     * 得到已赞shareId列表
     *
     * @param userId *
     * @return *
     */
    List<Long> getUserPraiseList(Long userId) throws Exception;

    /**
     * 屏蔽
     *
     * @param shareId *
     * @param userId  浏览者
     * @param isDo    正方向
     */
    void hide(Long shareId, Long userId, boolean isDo) throws Exception;

    List<Long> getUserHideList(Long userId) throws Exception;

    /**
     * 收藏
     *
     * @param shareId *
     * @param userId *
     * @param isDo 正方向
     */
    void collect(Long shareId, Long userId, boolean isDo) throws Exception;

    List<Long> getUserCollectList(Long userId) throws Exception;

    /**
     * 关注
     *
     * @param targetId 关注对象
     * @param userId *
     * @param isDo 正方向
     */
    void star(Long targetId, Long userId, boolean isDo) throws Exception;

    List<Long> getUserStarList(Long userId) throws Exception;

    ShareVO share2VO(Share share, Long userId, boolean fast) throws Exception;

    List<ShareVO> share2VO(List<Share> shares, Long userId, boolean fast) throws Exception;

    UserVO[] atIds2VOs(String atIds) throws Exception;

    UserVO[] atIds2VOs(List<Long> atIds) throws Exception;
}
